//获取应用实例
const app = getApp()
Page({

  /**
   * 页面的初始数据
   */
  data: {
    phone: '',
    userInfo: {
      avatarUrl: '/images/head.jpg',
      nickName: ''
    }
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      phone: app.globalData.phone
    });
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
    
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    this.setData({
      phone: app.globalData.phone
    });
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
    wx.reLaunch({
      url: './user',
    });
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
    
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    
  },
  onGotUserInfo: function (e) {
    console.log(e.detail.errMsg)
    console.log(e.detail.userInfo)
    console.log(e.detail.rawData)
    this.setData({
      userInfo: e.detail.userInfo
    })
  },
  getUserInfo: function() {
    var that = this;
    wx.getUserInfo({
      success: function(res) {
        that.setData({
          userInfo: res.userInfo
        })
        that.update();
      }
    })
  },
  login: function() {
    wx.navigateTo({
      url: '../login/login',
    })
  },

  myOrderDTOS: function() {
    wx.navigateTo({
      url: '/pages/orders/myOrders/myOrders',
    })
  },

  getOrders:function() {
    wx.navigateTo({
      url: '/pages/orders/getOrders/getOrders',
    })
  },

  myOrders:function() {
    wx.navigateTo({
      url: '/pages/orders/myOrders/myOrders',
    })
  },

  settings:function() {
    wx.navigateTo({
      url: './logout/logout',
    })
  },

  service:function() {
    wx.navigateTo({
      url: './service/service',
    })
  },

  wallet:function() {
    wx.navigateTo({
      url: './wallet/wallet',
    })
  },
  find: function() {
    wx.navigateTo({
      url: './find/find',
    })
  }
})